		<h4><img src="<?php echo $html->url('/img/admin/permissions.png');?>" /> <?php __('manager_permissions');?></h4>

		<form id="f_registers" action="<?php echo $html->url('changePermissions'); ?>" method="post">

			<div class="white_box white_box_last">

				<label><?php __('permissions_for_group');?>: <strong><?php echo $register['Group']['name']?></strong></label>

				<!-- pestañas -->
				<ul id="tabs">
					<li>
						<a href="#tab1"><?php __('actions');?></a>
					</li>
					<li>
						<a href="#tab2"><?php __('pages');?></a>
					</li>
				</ul>

				<!-- Permisos de metodos -->
				<div class="panel div_permissions" id="tab1">

					<h4>
				  		<?php __('name');?>
						<span id="tag_allow"><?php __('allow');?></span>
					</h4>

					<ul>
					<?php

						$open = true;//Indica si se escribio un "<ul><li>"
						foreach($registers_permissions as $register_permission){ 

							if($data_root['Aco']['id'] == $register_permission['Aco']['parent_id']){//Es un padre o controlador
								//indica si la subdivision de los metodos de administracion ya fue dibujada
								$view_division_administration = false;
								//indica si la subdivision de los metodos públicos ya fue dibujada
								$view_division_public = false;
					
								if(!$open){
									echo "</li></ul>";
									$open = true;
								} 
					?>

						<li id="reg_<?php echo $register_permission['Aco']['id'];?>" name="reg_<?php echo $register_permission['Aco']['id'];?>">
						<p>
							<span 
								id="span_registers_<?php echo $register_permission['Aco']['id'];?>" 
								class="retract" 
								onclick="javascript:$('registers_<?php echo $register_permission['Aco']['id'];?>').toggle();$('span_registers_<?php echo $register_permission['Aco']['id'];?>').toggleClassName('expand');"
							>
							</span>
 
							<?php echo $register_permission['Aco']['alias'];?>

							<input
								type="checkbox" 
								class="chk_allow"
								value="1"
								name="reg_<?php echo $register_permission['Aco']['id'];?>"
								onclick="javascript:checkAllPermissions(<?php echo $register_permission['Aco']['id'];?>);"

							<?php 
							if(isset($active_permissions_view[$register_permission['Aco']['id']]['_read']) && $active_permissions_view[$register_permission['Aco']['id']]['_read'] == 1){
							?> 
								checked="true"
							<?php 
								$parent_checked = true;
							}else{ 
								$parent_checked = false;
							}
							?>
					
							<?php 
							if(isset($active_permissions_view[$register_permission['Aco']['id']]['disabled']) && $active_permissions_view[$register_permission['Aco']['id']]['disabled']){?>
								disabled="true"
							<?php } ?>
							/>

						</p>

						<?php 
							}else{
								if($open){
									//Abrimos un nuevo grupo de hijos (metodos)
									echo "<ul id='registers_".$register_permission['Aco']['parent_id']."' style='display:none;'>";
									$open = false;
								}
								

							//Para realizar división visual entre metodos públicos y propios de la administración
							if(substr($register_permission['Aco']['alias'],0,5) == 'admin' && !$view_division_administration){?>
						<li class="subdivision"><?php __('administration_methods');?></li>
							<?php $view_division_administration = true; }elseif(substr($register_permission['Aco']['alias'],0,5) != 'admin' && !$view_division_public){?>
						<li class="subdivision" colspan="2"><?php __('public_methods');?></li>
							<?php $view_division_public = true; } ?>

							<?php if(!preg_match('/pagecreated-/',$register_permission['Aco']['alias'])){//Elimino de este arbol las páginas creadas?>
						<li id="reg_<?php echo $register_permission['Aco']['id'];?>" name="reg_<?php echo $register_permission['Aco']['id'];?>">
							<?php
									if(substr($register_permission['Aco']['alias'],0,5) == 'admin'){
										echo substr($register_permission['Aco']['alias'],6);
									}else{
										echo $register_permission['Aco']['alias'];
									}
							?>

						<input
							type="checkbox"
							class="chk_allow"
							value="1"
							name="reg_<?php echo $register_permission['Aco']['id'];?>"
							<?php if((isset($active_permissions_view[$register_permission['Aco']['id']]['_read']) && $active_permissions_view[$register_permission['Aco']['id']]['_read'] == 1) || $parent_checked){?> 
							checked="true"
							<?php } ?>

							<?php if((isset($active_permissions_view[$register_permission['Aco']['id']]['disabled']) && $active_permissions_view[$register_permission['Aco']['id']]['disabled']) || $parent_checked){?>
							disabled="true"
							<?php } ?>
						/>

						</li>
					<?php 
							}//Fin condicion preg_match
						}//Fin diferencia entre padre e hijos
					}//FIn Bucle
					?>
					</ul>
				</div>

				<!-- Permisos de páginas creadas -->
				<div class="panel div_permissions" id="tab2">

					<h4>
				  		<?php __('name');?>
						<span id="tag_allow"><?php __('allow');?></span>
					</h4>

					<ul>
					<?php
						foreach($registers_permissions as $register_permission){ 
							if(preg_match('/pagecreated-/',$register_permission['Aco']['alias'])){//Solo muestro las páginas creadas
					?>
						<li id="reg_<?php echo $register_permission['Aco']['id'];?>" name="reg_<?php echo $register_permission['Aco']['id'];?>" class="child">
							<?php echo substr($register_permission['Aco']['alias'],12);?>
							<input
								type="checkbox"
								class="chk_allow"
								value="1"
								name="reg_<?php echo $register_permission['Aco']['id'];?>"
								<?php if((isset($active_permissions_view[$register_permission['Aco']['id']]['_read']) && $active_permissions_view[$register_permission['Aco']['id']]['_read'] == 1)){?> 
								checked="true"
								<?php } ?>

								<?php if(isset($active_permissions_view[$register_permission['Aco']['id']]['disabled']) && $active_permissions_view[$register_permission['Aco']['id']]['disabled']){?>
								disabled="true"
								<?php } ?>

							/>

						</li>
						<?php }//Fin condicion preg_macth
							}//Fin bucle ?>
					</ul>

				</div>

			<!-- ID que pertenece el Group -->
			<?php echo $form->hidden('User.id',array('value' => $register['User']['id']));?>
		
			</div>

			<input type="submit" name="bot_guardar" class="input_button" value="<?php __('save');?>" />

		</form>

		<!-- Pestañas -->
		<?php echo $html->script(array('fabtabulous'));?>
